home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10369 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  27 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.sprintlink.net!news1!ts02-and-07
  3. From: dlmiller@iquest.net (Doug & Rose Miller)
  4. Subject: Re: Determining the length of an int in string form
  5. X-Nntp-Posting-Host: ts02-and-07.iquest.net
  6. Message-ID: <DoE38u.GIH@iquest.net>
  7. Sender: news@iquest.net (News Admin)
  8. Organization: IQuest Network Services
  9. X-Newsreader: News Xpress Version 1.0 Beta #2.1
  10. References: <3146D058.DD7@cbm.com> <4i7uth$qph@inet-nntp-gw-1.us.oracle.com>
  11. Date: Sun, 17 Mar 1996 02:02:28 GMT
  12.  
  13. wkaufman@wkaufman.us.oracle.com (William Kaufman) wrote:
  14. +In article <3146D058.DD7@cbm.com> Dave Payne <paynedc@cbm.com> writes:
  15. +] Consider this:
  16. +]
  17. +] I have a variable of type int, and I would like to use the sprintf()
  18. +] function to write this variable to a string.  However, I want to
  19. +] dynamically allocate the space for the string, and only malloc enough
  20. +] space to hold the int.
  21.  
  22. WHY ???
  23.  
  24. Even a 32-bit int is only 9 characters at most, and that's *with* the sign.  Why not just declare
  25. a string and be done with it?  Is storage space that tight for you, that nine bytes matters?
  26.  
  27.